home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / ShellPanel / NIDomain.m < prev    next >
Text File  |  1995-06-12  |  1KB  |  47 lines

  1. /* File: NIDomain.m - (Interactive) Unix shell version of NIDomainPanel
  2.  *
  3.  * By: Christopher Lane (lane@sumex-aim.stanford.edu)
  4.  *
  5.  * Date: 16 July 1991
  6.  *
  7.  * Copyright: 1991 by The Leland Stanford Junior University.
  8.  */
  9.  
  10. #import <stdlib.h>
  11. #import <getopt.h>
  12. #import <nikit/NIDomainPanel.h>
  13. #import <appkit/Application.h>
  14.  
  15. #define USAGE "usage: %s \n"
  16. #define EXIT_USAGE (2)
  17.  
  18. void main(int argc, char *argv[])
  19. {
  20.     int option, status = EXIT_SUCCESS;
  21.     
  22.     NXApp = [Application new];
  23.     
  24.     while ((option = getopt(argc, argv, "")) != EOF)
  25.         switch (option) {
  26.         default : status = EXIT_USAGE;
  27.         }
  28.     if (optind < argc) status = EXIT_USAGE;
  29.     
  30.     if (status == EXIT_USAGE) (void) fprintf(stderr, USAGE, [NXApp appName]);
  31.     else {
  32.         int flags, context = [NXApp activateSelf:YES];
  33.         NIDomainPanel *panel = [NIDomainPanel new];
  34.         
  35.         if ((flags = [panel runModal]) == NX_OKTAG) (void) puts([panel domain]);
  36.         else status = flags;
  37.                 
  38.         [panel free];
  39.         
  40.         if (context) (void) [NXApp activate:context];
  41.         }
  42.         
  43.     [NXApp free];
  44.     
  45.     exit(status);
  46. }
  47.